package com.syni.mdd.sjb.common.datatreaure.controller.protect;


import com.syni.mdd.sjb.common.component.utils.common.annotations.CheckUserIdentity;
import com.syni.mdd.sjb.common.datatreaure.controller.BaseController;
import com.syni.mdd.sjb.common.datatreaure.entity.vo.rq.BaseRqVo;
import com.syni.mdd.sjb.common.datatreaure.entity.vo.rq.userNewsSwitch.OpenCloseVo;
import com.syni.mdd.sjb.common.datatreaure.service.DxshAppUserNewsSwitchService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * <p>
 * 电享生活app消息表 前端控制器
 * </p>
 *
 * @author lcc
 * @since 2020-05-14
 */
@RestController
@RequestMapping("/userNewsSwitch")
public class DxshAppUserNewsSwitchController extends BaseController {

    @Autowired
    DxshAppUserNewsSwitchService dxshAppUserNewsSwitchService;

    @PostMapping("/set")
    @ApiOperation(value = "消息通知设置")
    @CheckUserIdentity
    public Map<String,Object> set(@RequestBody @Validated BaseRqVo baseRqVo){
        return dxshAppUserNewsSwitchService.set(baseRqVo);
    }

    @PostMapping("/openClose")
    @ApiOperation(value = "设置消息通知")
    @CheckUserIdentity
    public Map<String,Object> openClose(@RequestBody @Validated OpenCloseVo openCloseVo){
        Integer id = openCloseVo.getId();
        Integer isOpen = openCloseVo.getIsOpen();
        return dxshAppUserNewsSwitchService.openClose(id,isOpen);
    }
}
